<style>
.layui-form-pane .layui-form-label {
	display: flex;
	align-items: center;
	justify-content: center;
}
</style>
<div class="model" style="display: none">${model}</div>
<div class="form-compile">
	<form class="layui-form" lay-filter="edit-form">
		<input type="hidden" name="userId" />

		<div class="layui-form-item">
			<div class="layui-inline">
				<label class="layui-form-label">用户名</label>
				<div class="layui-input-inline">
					<input name="userName" class="layui-input">
				</div>
			</div>
			<div class="layui-inline">
				<label class="layui-form-label">用户编码</label>
				<div class="layui-input-inline">
					<input name="userCode" class="layui-input">
				</div>
			</div>
		</div>
		<div class="layui-form-item">
			<div class="layui-inline">
				<label class="layui-form-label">手机号</label>
				<div class="layui-input-inline">
					<input name="phone" class="layui-input">
				</div>
			</div>
			<div class="layui-inline">
				<label class="layui-form-label">邮箱</label>
				<div class="layui-input-inline">
					<input name="email" class="layui-input">
				</div>
			</div>
		</div>
		<div class="layui-form-item">
			<div class="layui-inline">
				<label class="layui-form-label">性别</label>
				<div class="layui-input-inline">
					<select id="userSex" name="sex"></select>
				</div>
			</div>
			<div class="layui-inline">
				<label class="layui-form-label">状态</label>
				<div class="layui-input-inline">
					<select id="userStatus" name="userStatus" disabled></select>
				</div>
			</div>

		</div>

		<div class="layui-form-item">
			<div class="layui-inline">
				<label class="layui-form-label">角色</label>
				<div class="layui-input-inline">
					<div id="role"></div>
				</div>
			</div>
			<div class="layui-inline">
				<label class="layui-form-label">部门</label>
				<div class="layui-input-inline">
					<div id="dept"></div>
				</div>
			</div>
		</div>
		<div class="layui-form-item">
			<div class="layui-inline">
				<label class="layui-form-label">备注</label>
				<div class="layui-input-inline">
					<textarea class="layui-textarea" name="remark"></textarea>
				</div>
			</div>

		</div>


		<div class="layui-form-item form-finally">
			<button type="button" class="layui-btn" lay-submit=""
				lay-filter="user-save" id="userSave">保存</button>
			<button type="button" class="layui-btn" onclick="closePopup()">关闭</button>
		</div>
	</form>
</div>
<script>
	layui.use([ 'xmSelect' ], function() {
		var xmSelect = layui.xmSelect;
		$("#userSex").initSelectDict();
		$("#userStatus").initSelectDict();

		var model = $(".model").text();
		var roleList = JSON.parse(model).roleList;
		var roleData = [];
		for (key in roleList) {
			var data = {};
			data.name = roleList[key].roleName;
			data.value = roleList[key].roleId;
			data.selected = true;
			roleData.push(data);
		}
		var role = xmSelect.render({
			el : '#role',
			language : 'zn',
			disabled : true,
			autoRow : true,
			data : roleData
		})

		var deptList = JSON.parse(model).deptList;
		var deptData = [];
		for (key in deptList) {
			var data = {};
			data.name = deptList[key].deptName;
			data.value = deptList[key].deptId;
			data.selected = true;
			deptData.push(data);
		}
		var dept = xmSelect.render({
			el : '#dept',
			language : 'zn',
			disabled : true,
			autoRow : true,
			data : deptData
		})

		initFormData();

		$("#userSave").formSubmit({
			url : ctx + "/sys/user/edit"
		});
		layui.form.render();

	})
</script>

